package com.jzr.task.db1.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MyPrimaryMapper {
    @Select("select id from t_patient where code=#{code} and cure_no=#{cureCode}")
    Integer getPatientId(String code,String cureCode);

    @Select("select id from t_dept where code=#{code}")
    Integer getDeptId(String code);

    @Select("select id from t_doctor where code=#{code}")
    Integer getDoctorId(String code);

    @Select("select id from t_nurse where code=#{code}")
    Integer getNurseId(String code);

    @Select("select id from t_bed where dept_code=#{deptCode} and room_code=#{roomCode} and bed_code=#{bedCode}")
    Integer getBedId(String deptCode,String roomCode,String bedCode);

    @Update("update t_bed set patient_id=#{patientId} where dept_code=#{deptCode} and room_code=#{roomCode} and bed_code=#{bedCode}")
    Integer bindPatientToBed(String deptCode,String roomCode,String bedCode,Integer patientId);

    Integer removePatientForOutPatient(@Param("list") List<Integer> list);
}
